package com.gxa.saas.service.impl;

import com.gxa.saas.mapper.PurchaseRequestMapper;
import com.gxa.saas.pojo.Purchase;
import com.gxa.saas.pojo.PurchaseRequest;
import com.gxa.saas.pojo.Storage;
import com.gxa.saas.service.PurchaseRequestService;
import com.gxa.saas.service.PurchaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.PreparedStatement;
import java.util.List;
import java.util.Map;
import java.util.function.Supplier;

@Service
public class PurchaseRequestServiceImpl implements PurchaseRequestService {

    @Autowired
    PurchaseRequestMapper purchaseRequestMapper;

    @Override
    public List<PurchaseRequest> selectBySecondPage(Integer offset, Integer size) {
        return purchaseRequestMapper.selectBySecondPage(size*(offset-1),size);
    }

    @Override
    public Integer insert(PurchaseRequest purchaseRequest) {
        return purchaseRequestMapper.insert(purchaseRequest);
    }

    @Override
    public List<PurchaseRequest> selectLikeName(String name, Integer offset, Integer size) {
        return purchaseRequestMapper.selectLikeName(name, offset, size);
    }

    @Override
    public Integer update(Purchase purchase) {
        return purchaseRequestMapper.update(purchase);
    }

    @Override
    public Integer delete(Integer id) {
        return purchaseRequestMapper.delete(id);
    }

    @Override
    public Storage selectById(Integer id) {
        return purchaseRequestMapper.selectById(id);
    }

    @Override
    public List<PurchaseRequest>  selectBySupplier() {
        return purchaseRequestMapper.selectBySupplier();
    }

    @Override
    public List<PurchaseRequest> selectByPayType() {
        return purchaseRequestMapper.selectByPayType();
    }

    @Override
    public List<PurchaseRequest> selectByApprover() {
        return purchaseRequestMapper.selectByApprover();
    }

    @Override
    public List<PurchaseRequest> selectByCreatePerson() {
        return purchaseRequestMapper.selectByCreatePerson();
    }

    @Override
    public List<PurchaseRequest> selectByNumber(Integer id) {
        return purchaseRequestMapper.selectByNumber(id);
    }

    @Override
    public Integer submit(Purchase purchase) {
        return purchaseRequestMapper.submit(purchase);
    }

    @Override
    public Integer getGotal() {
        return purchaseRequestMapper.getGotal();
    }

    @Override
    public Integer updateByAmount(Integer id, Integer bigAmount, Integer smallAmount,Double money) {
        return purchaseRequestMapper.updateByAmount(id, bigAmount, smallAmount,money);
    }

    @Override
    public PurchaseRequest selectByPrId(Integer pid) {
        return purchaseRequestMapper.selectByPrId(pid);
    }

    @Override
    public List<PurchaseRequest> selectAll() {
        return purchaseRequestMapper.selectAll();
    }

    @Override
    public Integer getTotal() {
        return purchaseRequestMapper.getTotal();
    }

    @Override
    public List<PurchaseRequest> selectByFid(Integer id) {
        return purchaseRequestMapper.selectByFid(id);
    }

    @Override
    public List<Purchase> selectByUid(Integer id) {
        return purchaseRequestMapper.selectByUid(id);
    }

}
